//p4715淘汰赛

#include <iostream>
#include <cmath>
using namespace std;

const unsigned maxsize = 100000;

int main() {
    int n; cin >> n;
    int list[maxsize];
    int oriList[maxsize];
    int oriSize = pow(2, n);
    int size = oriSize;

    for (int i = 0; i < oriSize; i ++) {
        cin >> list[i];
        oriList[i] = list[i];
    }

    while(size > 2) {
        int j = 0;
        for (int i = 0; i < size; i ++) {
            if (i % 2 == 0) { //如果是奇数
                int newNum = list[i] > list[i+1] ? list[i] : list[i+1];
                list[j ++] = newNum;
            } 
        }
        size = j;   
    }

    int answer = list[0] > list[1] ? list[1] : list[0];
    for (int i = 0; i < oriSize; i ++) {
        if (oriList[i] == answer) {
            answer = i + 1;
            break;
        }
    }
    cout << answer << endl;
    return 0;
}